]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
panelMenu: consider scale factor when setting max-height
authorCosimo Cecchi <cosimoc@gnome.org>
Fri, 7 Apr 2017 01:17:12 +0000 (18:17 -0700)
committerCosimo Cecchi <cosimoc@gnome.org>
Fri, 7 Apr 2017 01:32:04 +0000 (18:32 -0700)
Since the workarea and margins are both in pysical pixels dimensions (we
fetch margins from Clutter, not from the theme), but the CSS expects
logical (scaled) pixels, unless we consider the scale factor when
setting max-height, it won't work on a HiDpi display.

This fixes missing scrollbars when the calendar popup is full on HiDpi
displays.

https://bugzilla.gnome.org/show_bug.cgi?id=753305

js/ui/panelMenu.js

index d427ab5ffad07e0742343fe49ef9f8e3ea343c54..662287ef24a4d41f186deb47e6551602e5604023 100644 (file)
@@ -174,8 +174,14 @@ const Button = new Lang.Class({
         // menu is higher then the screen; it's useful if part of the menu is
         // scrollable so the minimum height is smaller than the natural height
         let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
+        let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
         let verticalMargins = this.menu.actor.margin_top + this.menu.actor.margin_bottom;
-        this.menu.actor.style = ('max-height: ' + Math.round(workArea.height - verticalMargins) + 'px;');
+
+        // The workarea and margin dimensions are in physical pixels, but CSS
+        // measures are in logical pixels, so make sure to consider the scale
+        // factor when computing max-height
+        let maxHeight = Math.round((workArea.height - verticalMargins) / scaleFactor);
+        this.menu.actor.style = ('max-height: %spx;').format(maxHeight);
     },
 
     destroy: function() {